package itcz.example.pattern.behavior_type.command;

import java.util.ArrayList;
import java.util.List;

/**
 * @ClassName: Waitor
 * @Author: ITCZ
 * @Date: 2025-07-23
 * @Description:命令模式-调用者/请求者角色
 */
public class Waitor {
    // 持有多个命令对象
    private List<Command> commandList = new ArrayList<Command>();

    public void setCommand(Command command) {
        commandList.add(command);
    }

    // 发起命令功能
    public void orderUp() {
        System.out.println("开始处理命令-美女服务员：叮咚，大厨，新订单来了.......");
        for (Command command : commandList) {
            if (command != null) {
                command.execute();
            }
        }
    }
}
